package com.youlu.campus.admin.community.controller;

import com.youlu.campus.admin.auth.entity.SystemUser;
import com.youlu.campus.admin.auth.service.UserService;
import com.youlu.campus.admin.utils.AuthUtils;
import com.youlu.campus.common.base.RestResult;
import com.youlu.campus.common.base.RestResultBuilder;
import com.youlu.campus.service.activity.ActivityCopyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 活动复制控制器
 */
@RestController
public class ActivityCopyController {

    @Autowired
    private ActivityCopyService activityCopyService;

    @Autowired
    private UserService userService;

    @GetMapping("/activity-copy/do")
    public RestResult doCopy(@RequestParam("activityId") String activityId){
        SystemUser systemUser = userService.get(AuthUtils.getUserId());
        activityCopyService.doCopy(AuthUtils.getUserId(),systemUser.getRealName(),activityId);
        return RestResultBuilder.builder().data(null).success().build();
    }
}
